package app.qrcode.browser.hearttoheart.activities

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.text.Html
import androidx.core.widget.doAfterTextChanged
import app.qrcode.browser.hearttoheart.databinding.ActivityLoginBinding

class LoginActivity : AppCompatActivity() {

    private lateinit var binding: ActivityLoginBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityLoginBinding.inflate(layoutInflater)
        setContentView(binding.root)
        val signInTip =
            "登录即表明同意 <font color = \"#03A9F4\">用户协议</font> 和 <font color = \"#03A9F4\">隐私政策</font>"
        binding.textView3.text = Html.fromHtml(signInTip)
        binding.signInBtn.isSelected = false
        binding.signInBtn.setOnClickListener {
            val intent = Intent(this, FunctionActivity::class.java)
            startActivity(intent)
        }
        binding.editText.doAfterTextChanged {
            binding.signInBtn.isSelected = (it.toString().length == 11)
        }
    }
}